
<script src="<?php echo base_url() ?>ckeditor/ckeditor.js"></script>
<script src="<?php echo base_url() ?>ckeditor/adapters/jquery.js"></script>
<style>

#editable
{
	padding: 10px;
	float: left;
}
</style>
<script>

CKEDITOR.disableAutoInline = true;

$( document ).ready( function() {
      $( '#editor1' ).ckeditor(); // Use CKEDITOR.replace() if element is <textarea>.
      $( '#editor2' ).ckeditor(); // Use CKEDITOR.replace() if element is <textarea>.
      $( '#editable' ).ckeditor(); // Use CKEDITOR.inline().
  } );

function setValue() {
	$( '#editor1' ).val( $( 'input#val' ).val() );
	$( '#editor2' ).val( $( 'input#va2' ).val() );
}

</script>




<div id="page-wrapper">

<div class="container-fluid">

    <!-- Page Heading -->
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">
                Kelola Pegawai
            </h1>
            <ol class="breadcrumb">
                <li>
                    <i class="fa fa-dashboard"></i>  <a href="<?php echo base_url(); ?>home">Dashboard</a>
                </li>
                <li class="active">
                    <i class="fa fa-edit"></i> Kelola Pegawai
                </li>
                <li class="active">
                    <i></i> <a href="<?php echo base_url(); ?>modul/manager_marketing">Manager Marketing</a>
                </li>
            </ol>
        </div>
    </div>
    <!-- /.row -->
	<div class="col-lg-6">
		<h2>Edit Manager Marketing</h2><br>
		<?php $attributs = 'class="mws-form"'?>
		<?php echo form_open_multipart('modul/manager_marketing/update', $attributs) ?>
            <form role="form">
            	<?php foreach($manager_marketing as $mm): ?>
                <div class="form-group">
                    <label>Nama</label>
                    <span class="error"><font color="red"><?php echo form_error('nama_manager_marketing'); ?></font></span>
                    <input class="form-control" name="nama_manager_marketing" value="<?php echo $mm->nama_manager_marketing ?>">
                    <p class="help-block">Diisi dengan nama lengkap.</p>
                </div>

                <div class="form-group">
                    <label>Username</label>
                    <input class="form-control" id="disabledInput" value="<?php echo $mm->username_manager_marketing ?>" placeholder="Disabled input" disabled>
                    <p class="help-block">Minimal 5 karakter.</p>
                </div>

                <div class="form-group">
					<label>Tanggal Lahir</label>
					<span class="error"><font color="red"><?php echo form_error('tgl_lahir_manager_marketing'); ?></font></span><br>
					<?php echo form_input('tgl_lahir_manager_marketing', $mm->tgl_lahir_manager_marketing, 'id="datepicker"'); ?><br />
				</div>

				<div class="form-group">
                    <label>Jenis Kelamin</label>
                    <span class="error"><font color="red"><?php echo form_error('jenis_kelamin_manager_marketing'); ?></font></span>
                    <label class="radio-inline">
                        <input type="radio" name="jenis_kelamin_manager_marketing" id="optionsRadiosInline1" value="L" <?php if($mm->jenis_kelamin_manager_marketing=='L') echo "checked"; ?> >Laki-laki
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="jenis_kelamin_manager_marketing" id="optionsRadiosInline2" value="P" <?php if($mm->jenis_kelamin_manager_marketing=='P') echo "checked"; ?>>Perempuan
                    </label>
                </div>

                <div class="form-group">
                    <label>Alamat</label>
                    <span class="error"><font color="red"><?php echo form_error('alamat_manager_marketing'); ?></font></span>
                    <textarea class="form-control" rows="3" name="alamat_manager_marketing" ><?php echo $mm->alamat_manager_marketing ?></textarea>
                </div>

                <div class="form-group">
                    <label>kontak</label>
                    <?php foreach($kontak as $k): ?>
                    <div id="oldRow<?php echo $k->id_kontak ?>">
                    <span class="input-group-addon">
        				<select name="tipe_kontak[<?php echo $k->id_kontak ?>]" class="form-control">
                            <option value="mobile" <?php if($k->tipe_kontak=='mobile') echo"selected";?>>Mobile</option>
                            <option value="home" <?php if($k->tipe_kontak=='home') echo"selected";?>>Home</option>
                            <option value="fax" <?php if($k->tipe_kontak=='fax') echo"selected";?>>Fax</option>
                            <option value="email" <?php if($k->tipe_kontak=='email') echo"selected";?>>Email</option>
                            <option value="other" <?php if($k->tipe_kontak=='other') echo"selected";?>>Other</option>
                        </select>
                    </span>
                    <input type="text" name="kontak[<?php echo $k->id_kontak ?>]" class="form-control" value="<?php echo $k->kontak ?>">
                    <p class="help-block"> <input type="checkbox" name="delete_ids[]" value="<?php echo $k->id_kontak ?>">Hapus </p> 
                    </div>                    
					<?php endforeach ?> 
					<div id="itemrow"></div>
                    <p class="help-block"><input type="button" class="btn btn-sm btn-success" onclick="addRow()" value="Add Row"></p>               
                </div>

                <div class="form-group">
                    <label>Input Foto</label>
                    <input type="file" name="userfile">
                </div>

                <div class="form-group">
					<img class="img-thumbnail" width="200px" src="<?php echo base_url() . $mm->url_foto_manager_marketing ?>" alt=""><br>
				</div>
				<?php echo form_hidden('gambar', $mm->url_foto_manager_marketing);?>
				<?php echo form_hidden('id_manager_marketing', $mm->id_manager_marketing);?>
				<?php echo form_hidden('username_manager_marketing', $mm->username_manager_marketing);?>
				<?php endforeach ?>
                <br>
                <button type="submit" class="btn btn-default">Submit</button>
                <button type="reset" class="btn btn-default">Reset</button>
    <!-- /.row -->

	</div>
	<!-- /.container-fluid -->

<?php echo form_close()?>

 <script>
  $(function() {
    $( "#datepicker" ).datepicker({
    	dateFormat: "yy-mm-dd"
    });
    $( "#datepicker2" ).datepicker(
    	{
    	minDate: 0,
    	dateFormat: "dd-mm-yy",
    });
  });

  var rowNum = 1;
  function addRow(){
        rowNum ++;
        var row = '<div id="rowNum'+rowNum+'"><span class="input-group-addon"><select name="tipe_kontak['+rowNum+']" class="form-control"><option value="mobile">Mobile</option><option value="home">Home</option><option value="fax">Fax</option><option value="email">Email</option><option value="other">Other</option></select></span><input type="text" name="kontak['+rowNum+']" class="form-control" ><p class="help-block"> <input type="button" class="btn btn-sm btn-danger" value="Remove" onclick="removeRow('+rowNum+');"></p></div>';
        $('#itemrow').append(row);
    }

  function removeRow(rnum) {
    $('#rowNum'+rnum).remove();
  }

  </script>